<template>
  <div>
    <el-button type="primary" @click="willAdd">添加</el-button>

    <v-form ref="form" :list="list" :info="info" @init="init"></v-form>

    <v-list :list="list" @edit="willEdit" @init="init"></v-list>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import vForm from "./components/form.vue";
import vList from "./components/list.vue";
import toggle from "../../mixins/toggle.js";
import { reqrolelist } from "../../request/api";
export default {
  mixins: [toggle],
  components: {
    vForm,
    vList,
  },
  computed: {
    ...mapGetters({}),
  },
  methods: {
    ...mapActions({}),

    init() {
      reqrolelist().then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.list;
          console.log(res);
        }
      });
    },
  },
  mounted() {
    // 获取列表
    this.init();
  },
  props: [],
  data() {
    return {
      info: {
        isshow: false, //展示还是隐藏from
        isAdd: true, //添加还是编辑
      },
      list: [],
    };
  },
};
</script>
<style lang="less" scoped>
</style>